package com.veo.dao;

import com.baomidou.mybatisplus.core.mapper.Mapper;
import com.veo.bean.User;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserDao extends Mapper<User> {

    @Select("select * from sys_user where username=#{username}")
    @Results({
            @Result(id = true, property = "id", column = "id"),
            @Result(property = "roles", column = "id", javaType = List.class,
                    many = @Many(select = "com.veo.dao.RoleDao.findByUid"))
    })
    public User findByUsername(String username);

}
